package com.devunion.bogdan.view.actions;

import com.devunion.bogdan.util.IconHelper;
import com.devunion.bogdan.view.dialogs.LoginDialog;
import com.devunion.bogdan.view.util.DialogHelper;

import javax.swing.*;
import java.awt.event.ActionEvent;

/**
 * @author Viktar Liaskovich
 */
public class LoginDlgAction extends AbstractAction {
    private LoginDialog loginDialog;


    public LoginDlgAction() {
        super(null, IconHelper.getIcon("Login24.png"));
    }

    public void actionPerformed(ActionEvent e) {
        if (loginDialog == null) {
            loginDialog = new LoginDialog(DialogHelper.getMainFrame());
        }

        loginDialog.pack();
        loginDialog.setLocationRelativeTo(null);

        loginDialog.setVisible(true);
    }
}